package 基础.类;

class Dog{
    //属性/成员变量：定义在方法的外部，类的内部
     String name ;
     int age;
     String color;
    //行为/成员方法
    public void food(){
        System.out.println(name +"喜欢吃骨头");
    }
    public void action(){
        System.out.println(name+"摇尾巴");
    }

    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.name ="小白";
        dog.age =2;
        dog.color ="黑色";

        dog.food();
        dog.action();
    }
}

class Cat{
     String name;
     int age;
     String color;

    public void food(){
        System.out.println(name +"喜欢吃鱼");
    }
    public void action(){
        System.out.println(name +"喵喵叫");
    }

    public static void main(String[] args) {
        Cat cat1 =new Cat();
        cat1.name = "coke";
        cat1.age = 2;
        cat1.color="黑色";

        cat1.food();
        cat1.action();
    }
}
public class 类 {
    public static void main(String[] args) {
        Cat cat1 =new Cat();
        cat1.name = "coke";
        cat1.age = 2;
        cat1.color="黑色";

        cat1.food();
        cat1.action();

        Dog dog = new Dog();
        dog.name ="小白";
        dog.age =2;
        dog.color ="黑色";

        dog.food();
        dog.action();
    }
}
